package com.baida.retail.tasksystem.controller;

import com.baida.retail.tasksystem.event.event.BlackListEvent;
import com.baida.retail.tasksystem.message.logic.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("event")
@Api(value = "事件测试模块", tags = "事件模块")
public class EventController {
    @Autowired
    private ApplicationEventPublisher applicationEventPublisher;

    @RequestMapping("/test")
    @ApiOperation(
            value = "事件测试")
    public Result test() {
        log.info("test");
        applicationEventPublisher.publishEvent(new BlackListEvent(this, "宁波华泰"));
        return new Result();
    }
}
